#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#  Copyright (c) Huoty - All rights reserved
#
#      Author: Huoty <sudohuoty@gmail.com>
#  CreateTime: 2017-12-02 20:10:49
# *************************************************************

from __future__ import print_function

import sys
import logging


class NoParsingFilter(logging.Filter):
    def filter(self, record):
        print("-" * 10, record.name)
        return record.name.startswith('test')

log = logging.getLogger()
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.addFilter(NoParsingFilter())
log.addHandler(handler)

log = logging.getLogger("hello")
log.info("hello")
log.error("error")

log1 = logging.getLogger("test.xxx")
log1.info("test log")

log2 = logging.getLogger("test")
log2.error("error")
